package abstractclass;

public class Demo01 {
    public static void main(String[] args) {
        Frog f = new Frog();//Frog f=0x1B
        method01(f);
        System.out.println("-----------");
       Animal a= method02();//Animal a=0X5D=new Frog();
       a.eat();//遵循多态调用原则
    }

    public static void method01(Animal a) {//Animal a=0x1B=new Frog();//多态
        a.eat();//遵循多态的调用原则
    }

    public static Animal method02() {
      /*  Frog frog = new Frog();//Frog frog=0x5D
        return frog;//返回 0X5D*/

        return new Frog();//这样写更简单，匿名对象

    }


}
